import request from '@/util/request'
import store from '@/vuex/store'

export function getAddressList(addressCode) {
    const value = {
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0,
        param: addressCode
    }
    return request({
        url: "address/getAddressList.do",
        method: "post",
        data: value
    })
}

export function getChildrenAddress(addressCode) {
    const value = {
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0,
        param: addressCode
    }
    return request({
        url: "address/getChildrenAddressList.do",
        method: "post",
        data: value
    })
}
export function getChildrenAddressByName(name) {
    const value = {
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0,
        param: name
    }
    return request({
        url: "address/getChildrenByName.do",
        method: "post",
        data: value
    })
}
export function selectByCode(code) {
    const value = {
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0,
        param: code
    }
    return request({
        url: "address/selectByCode.do",
        method: "post",
        data: value
    })
}

export function queryTownCodeByVillageCodeApi(code) {
    const value = {
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0,
        param: code
    }
    return request({
        url: "address/queryTownCodeByVillageCode.do",
        method: "post",
        data: value
    })
}

//通过villageCode查询villageList
export function queryVillageListByVillageCodeApi(villageCode) {
    const value = {
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0,
        param: villageCode
    }
    return request({
        url: "address/queryVillageListByVillageCode.do",
        method: "post",
        data: value
    })
}